﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using  CERT.PageLibrary.Base;
using OpenQA.Selenium.Support.PageObjects;
using OpenQA.Selenium;

namespace CERT.PageLibrary.Pages {
	public class LoginPage : PageBase {
		public override string DefaultTitle { get { return "Log On"; } }

		[FindsBy(How = How.Id, Using = "UserName")]
		IWebElement InputUsername { get; set; }

		[FindsBy(How = How.Id, Using = "Password")]
		IWebElement InputPassword { get; set; }

		[FindsBy(How = How.CssSelector, Using = "input[value='Log On']")]
		IWebElement ButtonLogin { get; set; }

		public TExpectedPage LoginBackTo<TExpectedPage>(string username, string password) where TExpectedPage : PageBase, new() {
			InputUsername.Clear();
			InputUsername.SendKeys(username);
			InputPassword.Clear();
			InputPassword.SendKeys(password);
			ButtonLogin.Click();

			return GetInstance<TExpectedPage>();
		}


	}
}
